<template>
  <div>
    <h1>Page页面</h1>
    <button @click="pageLink">跳转新闻页面</button>
    <router-link to='/page?id=555'>更新路由</router-link>
  </div>
</template>

<script >

export default {
  beforeRouteEnter(to, from, next) {
    // 组件路由 进入
    console.log('组件路由 进入');
    next()
  },
  beforeRouteUpdate(to, from, next) {
    // 组件路由 更新
    console.log('组件路由 更新');
    next()
  },
  beforeRouteLeave(to, from, next) {
    // 组件路由 离开
    console.log('组件路由 离开');
    next()
  },
  methods: {
    pageLink() {
      console.log('跳');
      //   this.$router.push({ path: '/news/223344' }) //    /news/223344
      //   this.$router.push({ name: 'news', params: { id: 112233 } }) //  /news/112233
      this.$router.push({ path: '/', query: { id: 666 } })  //     /?id=666
    },

  }
}

</script>

<style lang='' scoped></style>